import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class GD {
    public static void main(String[] args) {
        String str = "hello java";
        System.out.println(str.replaceFirst("\\w?","@"));
        System.out.println(str.replaceFirst("\\w*?","@"));

        Pattern p = Pattern.compile("a*b");
        Matcher m = p.matcher("abc");
        boolean b = m.matches();
        System.out.println(Pattern.matches("a*b","ab"));

    }
}
